package actions;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.ide.IDE;


import editors.*;

public class OpenEditor extends Action {
	private IWorkbenchWindow window;
	public OpenEditor(IWorkbenchWindow window)
	{
		this.window=window;
		this.setText("Welcome");
		
	}
	public void run()
	{
		try
		{
		window.getActivePage()
		.openEditor(new RSPEditorInput(), "RestServicePlatform.platform");
		}
		catch (Exception ex)
		{
		System.out.println(ex);
		}
		
		/*try 
		{
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("HelloWorld");
		
		              
	    IFile java_file = project.getFile("HelloWorld.bpel");
	    window.getActivePage().openEditor(new FileEditorInput(java_file),"org.eclipse.jdt.ui.CompilationUnitEditor");
	    //FileEditorInput ifile=new  FileEditorInput(java_file);
		//page.openEditor(ifile, "org.eclipse.jdt.ui.CompilationUnitEditor");            
	    } 
		catch (Exception e) 
		{
			
         System.out.println(e);

		}*/
	}

}
